import React from 'react';
import {connect} from 'dva';
import UserDetail from '../components/UserDetail';
import MainLayout from '../components/layouts/MainLayout';
import {Row, Col} from 'antd';
import {routerRedux} from 'dva/router';

const User = ({dispatch, user, rules}) => {
  const location = {
    pathname: '/user'
  };

  function handleModifyUser(id) {
    dispatch(routerRedux.push({
      pathname: '/usermodify',
      query: {
        id: id
      }
    }));
  }

  return (
    <MainLayout location={location}>
      <Row>
        <Col span={3}>

        </Col>
        <Col span={18}>
          <UserDetail user={user} handleModifyUser={handleModifyUser}/>
        </Col>
        <Col span={3}>

        </Col>
      </Row>
    </MainLayout>
  );
};

export default connect(({user}) => ({
  user
}))(User);
